package com.mxx.common.data.jpa;

import com.mxx.common.exception.UnImplementedException;

import javax.persistence.criteria.*;
import javax.persistence.metamodel.EntityType;
import javax.persistence.metamodel.SingularAttribute;

public class EmptyCriteriaUpdate<T> implements CriteriaUpdate<T> {
    public static final EmptyCriteriaUpdate INSTANCE = new EmptyCriteriaUpdate();

    private EmptyCriteriaUpdate() {

    }

    @Override
    public Root<T> from(Class<T> entityClass) {
        throw new UnImplementedException("this is EmptyCriteriaUpdate . from(Class<T> entityClass) not implemented");
    }

    @Override
    public Root<T> from(EntityType<T> entity) {
        throw new UnImplementedException("this is EmptyCriteriaUpdate . from(EntityType<T> entity) not implemented");
    }

    @Override
    public Root<T> getRoot() {
        throw new UnImplementedException("this is EmptyCriteriaUpdate . getRoot() not implemented");
    }

    @Override
    public <Y, X extends Y> EmptyCriteriaUpdate<T> set(SingularAttribute<? super T, Y> attribute, X value) {
        return this;
    }

    @Override
    public <Y> EmptyCriteriaUpdate<T> set(SingularAttribute<? super T, Y> attribute, Expression<? extends Y> value) {
        return this;
    }

    @Override
    public <Y, X extends Y> EmptyCriteriaUpdate<T> set(Path<Y> attribute, X value) {
        return this;
    }

    @Override
    public <Y> EmptyCriteriaUpdate<T> set(Path<Y> attribute, Expression<? extends Y> value) {
        return this;
    }

    @Override
    public EmptyCriteriaUpdate<T> set(String attributeName, Object value) {
        return this;
    }

    @Override
    public EmptyCriteriaUpdate<T> where(Expression<Boolean> restriction) {
        return this;
    }

    @Override
    public EmptyCriteriaUpdate<T> where(Predicate... restrictions) {
        return this;
    }

    @Override
    public <U> Subquery<U> subquery(Class<U> type) {
        throw new UnImplementedException("this is EmptyCriteriaUpdate . subquery(Class<U> type) not implemented");
    }

    @Override
    public Predicate getRestriction() {
        throw new UnImplementedException("this is EmptyCriteriaUpdate . getRestriction() not implemented");
    }
}
